/* 个人中心的接口 */
import { config } from "../config.js";
import {
  getAction,
  postAction,
  putAction,
  deleteAction,
} from "../utils/request.js";

// 我的企业=============================================
// 行业树
const informationTree = (params) =>
  getAction("/common/industry/information/tree", params);

// 列表
const messagePage = (params) => getAction("/company/message/page", params);

// 获取验证码
const messageSendsms = (params) =>
  postAction("/company/message/send_sms", params);

// 添加企业  --  所属派出所
const basePolice = (params) =>
  getAction("/common/sys/police_agency/base_police", params);

// 添加企业  -- 审核民警
const findPoliceAgencyList = (id) => {
  let params = {
    policeAgencyId: id,
  };
  return getAction(`/police/user/find_police_agency_list`, params);
};

// 添加企业
const messageSave = (params) => postAction("/company/message/save", params);

// 我的企业 -- 查看详情
const messageDetail = (params) => getAction("/company/message/detail", params);

// 根据业务类型及编号 获取图片
const imagesPathList = (params) =>
  getAction("/mini/sys/images_path/list", params);

// 我的企业 -- 查看详情  (从首页进入到该页面)
const companyChangeDetail = (params) =>
  getAction("/company/message/company_change_detail", params);

// 我的企业 -- 删除
const messageDelete = (id, mobileCode) =>
  deleteAction(`/company/message/delete?id=${id}&mobileCode=${mobileCode}`);

// 我的企业 -- 解绑 -- 新的绑定人手机号  调用的接口
const findMiniName = (mobile) =>
  getAction(`/sys/operate/find_mini_name?mobile=${mobile}`);

// 我的企业 -- 解绑
const changeUser = (params) =>
  postAction("/company/message/change_user", params);

// 我的企业 -- 修改信息 -- 法人验证 （点击下一步按钮调用）
const legalAuthenticate = (params) =>
  postAction("/company/message/legal_authenticate", params);

// 我的企业 -- 修改场所信息 -- 确定
const updateCompany = (params) =>
  postAction("/company/message/update_company", params);

// 我的企业 -- 修改信息 -- 负责人 （点击下一步按钮调用）
const dutyAuthenticate = (params) =>
  postAction("/company/message/duty_authenticate", params);

// 我的企业 -- 修改信息 -- 负责人 -- 确定
const checkDutyInfo = (params) =>
  postAction("/company/message/check_duty_info", params);

// 我的企业 -- 修改场所信息 -- 修改基本信息  -- 营业执照回显
const businessDetail = (params) =>
  getAction("/company/message/business_detail", params);

// 更换法人手机号 -- 新手机号 -- 确定
const checkLegalInfo = (params) =>
  postAction("/company/message/check_legal_info", params);

// 行业许可证 -- 详情
const certificateDetail = (params) =>
  getAction("/company/certificate/detail", params);

// 行业许可证 -- 保存
const certificateSave = (params) =>
  postAction("/company/certificate/save", params);

//  我的企业 -- 查看详情 -- 营业执照（未完善）  -- 保存
const saveBusiness = (params) =>
  postAction("/company/message/save_business", params);

// 特行许可证  字段识别（腾讯云后端给接口）
const smartStructuralOrc = (params) =>
  postAction("/txy/index/smart_structural_orc", params);

// 修改企业管理员 -- 列表
const userPage = (params) => getAction("/company/user/page", params);

// 判断当前账号下的企业，是为是管理员
const userFindResponsible = (params) =>
  getAction("/company/user/find_responsible", params);

// 修改企业管理员 -- 设置主要负责人
const userSetup = (params) => postAction("/company/user/set_up", params);

// 修改场所信息 -- 添加管理员二维码生成
const messageGetQrCode = (params) =>
  getAction("/company/message/get_qr_code", params);

// 修改场所信息 -- 添加管理员  扫描二维码跳转页面的信息
const findCompanyInfo = (params) =>
  getAction("/company/user/find_company_info", params);

// 修改场所信息 -- 添加管理员 -- 新增企业管理员 确认
const userInsert = (params) => postAction("/company/user/insert", params);

// 修改场所信息 -- 删除负责人
const userDelete = (id) => deleteAction(`/mini/company/user/delete?id=${id}`);

// 责任书管理=============================================
// 责任书管理分页  待签定
const waitSignPage = (params) =>
  getAction("/sys/document_company/wait_sign_page", params);

// 责任书管理分页  已签订
const signPage = (params) =>
  getAction("/sys/document_company/sign_page", params);

// 责任书管理分页  待签定 -- 提交签名
const documentCompanySign = (params) =>
  postAction("/sys/document_company/sign", params);

// 安全演练=============================================
// 列表 -- 安全演练
const FireDrillPage = (params) => getAction("/company/FireDrill/page", params);

// 新增 -- 安全演练
const FireDrillSave = (params) => postAction("/company/FireDrill/save", params);

// 详情 -- 安全演练
const FireDrillDetail = (params) =>
  getAction("/company/FireDrill/detail", params);

// 安全培训=============================================
// 列表 -- 安全培训
const fireTrainingPage = (params) =>
  getAction("/company/fireTraining/page", params);

// 新增 -- 安全培训
const fireTrainingSave = (params) =>
  postAction("/company/fireTraining/save", params);

// 详情 -- 安全培训
const fireTrainingDetail = (params) =>
  getAction("/company/fireTraining/detail", params);

// 活动申报=============================================
// 列表 -- 活动申报
const activityDeclarationPage = (params) =>
  getAction("/mini/common/activity_declaration/page", params);

// 新增 -- 活动申报
const activityDeclarationSave = (params) =>
  postAction("/mini/common/activity_declaration/save", params);

// 详情 -- 活动申报
const activityDeclarationDetail = (params) =>
  getAction("/mini/common/activity_declaration/detail", params);

// 撤回 -- 活动申报
const activityDeclarationRevocation = (params) =>
  getAction("/mini/common/activity_declaration/revocation", params);

// 活动取消 -- 活动申报
const activityDeclarationCancel = (params) =>
  postAction("/mini/common/activity_declaration/cancel", params);

export const maintenanceRecordsAdd = (params) =>
  postAction("/machine/maintenanceRecordsAdd", params);
export const maintenanceRecordsList = (params) =>
  getAction("/machine/maintenanceRecordsList", params);
export const maintenanceRecordsUpdate = (params) =>
  postAction("/machine/maintenanceRecordsUpdate", params);
export const getCarNumberList = (params) =>
  getAction("/machine/getCarNumberList", params);
export const maintenanceProntList = (params) =>
  getAction("/machine/maintenanceProntList", params);
export const maintenanceProntAdd = (params) =>
  postAction("/machine/maintenanceProntAdd", params);

export {
  informationTree,
  messagePage,
  messageSendsms,
  basePolice,
  findPoliceAgencyList,
  messageSave,
  messageDetail,
  imagesPathList,
  companyChangeDetail,
  messageDelete,
  findMiniName,
  changeUser,
  legalAuthenticate,
  updateCompany,
  dutyAuthenticate,
  checkDutyInfo,
  businessDetail,
  checkLegalInfo,
  certificateDetail,
  certificateSave,
  saveBusiness,
  smartStructuralOrc,
  userPage,
  userFindResponsible,
  userSetup,
  messageGetQrCode,
  findCompanyInfo,
  userInsert,
  userDelete,
  waitSignPage,
  signPage,
  documentCompanySign,
  FireDrillPage,
  FireDrillSave,
  FireDrillDetail,
  fireTrainingPage,
  fireTrainingSave,
  fireTrainingDetail,
  activityDeclarationPage,
  activityDeclarationSave,
  activityDeclarationDetail,
  activityDeclarationRevocation,
  activityDeclarationCancel,
};
